import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/",
    name: "LLayout",
    component: () => import("../components/LLayout.vue"),
    meta: {
      requireAuth: true,
    },
    children: [
      {
        path: "/index",
        name: "Index",
        component: () => import("../views/Index.vue"),
        meta: {
          requireAuth: true,
        },
      },
      {
        path: "/blog",
        name: "Blog",
        component: () => import("../views/Blog.vue"),
        meta: {
          requireAuth: true,
        },
      },
      {
        path: "/edit",
        name: "Edit",
        component: () => import("../views/Edit.vue"),
        meta: {
          requireAuth: true,
        },
      },
      {
        path: "/category",
        name: "Category",
        component: () => import("../views/Category.vue"),
        meta: {
          requireAuth: true,
        },
      },
      {
        path: "/distbin",
        name: "Distbin",
        children: [
          {
            path: "blog",
            name: "DistbinBlog",
            component: () => import("../views/dustbin/Blog.vue"),
            meta: {
              requireAuth: true,
            },
          },
          {
            path: "category",
            name: "DistbinCategory",
            component: () => import("../views/dustbin/Category.vue"),
            meta: {
              requireAuth: true,
            },
          },
        ],
        meta: {
          requireAuth: true,
        },
      },
      {
        path: "/user",
        name: "User",
        component: () => import("../views/User.vue"),
        meta: {
          requireAuth: true,
        },
      },
      {
        path: "/About",
        name: "about",
        component: () => import("../views/About.vue"),
        meta: {
          requireAuth: true,
        },
      },
    ],
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/Login.vue"),
    meta: {
      requireAuth: true,
    },
  },
  {
    path: "/register",
    name: "Register",
    component: () => import("../views/Register.vue"),
    // meta: {
    //   requireAuth: true,
    // },
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
